home *** CD-ROM | disk | FTP | other *** search
Text File | 1998-02-12 | 12.2 KB | 499 lines | [TEXT/MPS ] |
- ;
- ; File: OSUtils.a
- ;
- ; Contains: OS Utilities Interfaces.
- ;
- ; Version: Technology: Mac OS 8
- ; Release: Universal Interfaces 3.1
- ;
- ; Copyright: © 1985-1998 by Apple Computer, Inc., all rights reserved
- ;
- ; Bugs?: Please include the the file and version information (from above) with
- ; the problem description. Developers belonging to one of the Apple
- ; developer programs can submit bug reports to:
- ;
- ; devsupport@apple.com
- ;
- ;
- IF &TYPE('__OSUTILS__') = 'UNDEFINED' THEN
- __OSUTILS__ SET 1
-
- IF &TYPE('__MACTYPES__') = 'UNDEFINED' THEN
- include 'MacTypes.a'
- ENDIF
- IF &TYPE('__MIXEDMODE__') = 'UNDEFINED' THEN
- include 'MixedMode.a'
- ENDIF
- ; HandToHand and other memory utilties were moved to MacMemory.h
- IF &TYPE('__MACMEMORY__') = 'UNDEFINED' THEN
- include 'MacMemory.a'
- ENDIF
- ; GetTrapAddress and other trap table utilties were moved to Patches.h
- IF &TYPE('__PATCHES__') = 'UNDEFINED' THEN
- include 'Patches.a'
- ENDIF
- ; Date and Time utilties were moved to DateTimeUtils.h
- IF &TYPE('__DATETIMEUTILS__') = 'UNDEFINED' THEN
- include 'DateTimeUtils.a'
- ENDIF
- IF ¬ TARGET_OS_MAC THEN
- IF &TYPE('__ENDIAN__') = 'UNDEFINED' THEN
- include 'Endian.a'
- ENDIF
- ENDIF
-
- useFree EQU 0
- useATalk EQU 1
- useAsync EQU 2
- useExtClk EQU 3 ;Externally clocked
- useMIDI EQU 4
-
- false32b EQU 0 ;24 bit addressing error
- true32b EQU 1 ;32 bit addressing error
-
- ; result types for RelString Call
- sortsBefore EQU -1 ;first string < second string
- sortsEqual EQU 0 ;first string = second string
- sortsAfter EQU 1 ;first string > second string
-
- dummyType EQU 0
- vType EQU 1
- ioQType EQU 2
- drvQType EQU 3
- evType EQU 4
- fsQType EQU 5
- sIQType EQU 6
- dtQType EQU 7
- nmType EQU 8
- ; typedef SignedByte QTypes
-
- SysParmType RECORD 0
- valid ds.b 1 ; offset: $0 (0)
- aTalkA ds.b 1 ; offset: $1 (1)
- aTalkB ds.b 1 ; offset: $2 (2)
- config ds.b 1 ; offset: $3 (3)
- portA ds.w 1 ; offset: $4 (4)
- portB ds.w 1 ; offset: $6 (6)
- alarm ds.l 1 ; offset: $8 (8)
- font ds.w 1 ; offset: $C (12)
- kbdPrint ds.w 1 ; offset: $E (14)
- volClik ds.w 1 ; offset: $10 (16)
- misc ds.w 1 ; offset: $12 (18)
- sizeof EQU * ; size: $14 (20)
- ENDR
- ; typedef struct SysParmType * SysPPtr
-
- QElem RECORD 0
- qLink ds.l 1 ; offset: $0 (0)
- qType ds.w 1 ; offset: $4 (4)
- qData ds.w 1 ; offset: $6 (6) <-- really an array of length one
- sizeof EQU * ; size: $8 (8)
- ENDR
- ; typedef struct QElem * QElemPtr
-
- IF TARGET_OS_MAC THEN
- QHdr RECORD 0
- qFlags ds.w 1 ; offset: $0 (0)
- qHead ds.l 1 ; offset: $2 (2)
- qTail ds.l 1 ; offset: $6 (6)
- sizeof EQU * ; size: $A (10)
- ENDR
- ; typedef struct QHdr * QHdrPtr
-
- ELSE
-
- ; QuickTime 3.0:
- ; this version of QHdr contains the Mutex necessary for
- ; non-mac non-interrupt code
-
-
- QHdr RECORD 0
- qFlags ds.w 1 ; offset: $0 (0)
- pad ds.w 1 ; offset: $2 (2)
- MutexID ds.l 1 ; offset: $4 (4)
- qHead ds.l 1 ; offset: $8 (8)
- qTail ds.l 1 ; offset: $C (12)
- sizeof EQU * ; size: $10 (16)
- ENDR
- ; typedef struct QHdr * QHdrPtr
-
- ENDIF ; TARGET_OS_MAC
-
-
- DeferredTask RECORD 0
- qLink ds.l 1 ; offset: $0 (0)
- qType ds.w 1 ; offset: $4 (4)
- dtFlags ds.w 1 ; offset: $6 (6)
- dtAddr ds.l 1 ; offset: $8 (8)
- dtParam ds.l 1 ; offset: $C (12)
- dtReserved ds.l 1 ; offset: $10 (16)
- sizeof EQU * ; size: $14 (20)
- ENDR
- ; typedef struct DeferredTask * DeferredTaskPtr
-
- IF TARGET_OS_MAC THEN
- MachineLocation RECORD 0
- latitude ds.l 1 ; offset: $0 (0)
- longitude ds.l 1 ; offset: $4 (4)
- dlsDelta ds.b 1 ; offset: $8 (8) ; signed byte; daylight savings delta
- ORG 8
- gmtDelta ds.l 1 ; offset: $8 (8) ; use low 24-bits only
- sizeof EQU * ; size: $C (12)
- ENDR
- ELSE
- ;
- ; QuickTime 3.0:
- ; Alignment of MachineLocation is weird. The union above used for delta
- ; tends not to work on non-Mac compilers.
- ;
-
- MachineLocation RECORD 0
- latitude ds.l 1 ; offset: $0 (0)
- longitude ds.l 1 ; offset: $4 (4)
- delta ds BigEndianLong ; offset: $8 (8) ; high byte is daylight savings delta, low 24-bits is GMT delta
- sizeof EQU * ; size: $C (12)
- ENDR
- ENDIF ; TARGET_OS_MAC
- ;
- ; pascal Boolean IsMetric(void )
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- Macro
- _IsMetric
- move.w #$0004,-(sp)
- dc.w $A9ED
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION IsMetric
- ENDIF
-
- ;
- ; pascal SysPPtr GetSysPPtr(void )
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- Macro
- _GetSysPPtr &dest=(sp)
- move.l #$000001F8,&dest
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION GetSysPPtr
- ENDIF
-
-
- ;
- ; NOTE: SysBeep() has been moved to Sound.h.
- ; We could not automatically #include Sound.h in this file
- ; because Sound.h indirectly #include's OSUtils.h which
- ; would make a circular include.
- ;
-
- ;
- ; pascal OSErr DTInstall(DeferredTaskPtr dtTaskPtr)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; parameters:
- ; dtTaskPtr => A0
- ; returns:
- ; OSErr <= D0
- _DTInstall: OPWORD $A082
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION DTInstall
- ENDIF
-
-
-
- ;
- ; pascal SInt8 GetMMUMode(void)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- Macro
- _GetMMUMode &dest=(sp)
- move.b $0CB2,&dest
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION GetMMUMode
- ENDIF
-
- ;
- ; pascal SInt8 SwapMMUMode(SInt8 mode)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; parameters:
- ; mode => D0
- ; returns:
- ; SInt8 <= D0
- _SwapMMUMode: OPWORD $A05D
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION SwapMMUMode
- ENDIF
-
- ;
- ; pascal void Delay(unsigned long numTicks, unsigned long *finalTicks)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- _Delay: OPWORD $A03B
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION Delay
- ENDIF
-
-
- ;
- ; pascal OSErr WriteParam(void )
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- _WriteParam: OPWORD $A038
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION WriteParam
- ENDIF
-
- ;
- ; pascal void Enqueue(QElemPtr qElement, QHdrPtr qHeader)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; parameters:
- ; qElement => A0
- ; qHeader => A1
- _Enqueue: OPWORD $A96F
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION Enqueue
- ENDIF
-
- ;
- ; pascal OSErr Dequeue(QElemPtr qElement, QHdrPtr qHeader)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; parameters:
- ; qElement => A0
- ; qHeader => A1
- ; returns:
- ; OSErr <= D0
- _Dequeue: OPWORD $A96E
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION Dequeue
- ENDIF
-
- ;
- ; pascal OSErr InitUtil(void )
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; returns:
- ; OSErr <= D0
- _InitUtil: OPWORD $A03F
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION InitUtil
- ENDIF
-
-
- IF TARGET_CPU_PPC THEN
- ;
- ; pascal void MakeDataExecutable(void *baseAddress, unsigned long length)
- ;
- IF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION MakeDataExecutable
- ENDIF
-
- ENDIF ; TARGET_CPU_PPC
- IF TARGET_CPU_68K THEN
- ;
- ; pascal Boolean SwapInstructionCache(Boolean cacheEnable)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- Macro
- _SwapInstructionCache
- moveq #0,D0
- dc.w $A098
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION SwapInstructionCache
- ENDIF
-
- ;
- ; pascal void FlushInstructionCache(void )
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- Macro
- _FlushInstructionCache
- moveq #1,D0
- dc.w $A098
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION FlushInstructionCache
- ENDIF
-
- ;
- ; pascal Boolean SwapDataCache(Boolean cacheEnable)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- Macro
- _SwapDataCache
- moveq #2,D0
- dc.w $A098
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION SwapDataCache
- ENDIF
-
- ;
- ; pascal void FlushDataCache(void )
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- Macro
- _FlushDataCache
- moveq #3,D0
- dc.w $A098
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION FlushDataCache
- ENDIF
-
- ;
- ; pascal void FlushCodeCache(void )
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- _FlushCodeCache: OPWORD $A0BD
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION FlushCodeCache
- ENDIF
-
- ;
- ; pascal OSErr FlushCodeCacheRange(void *address, unsigned long count)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; parameters:
- ; address => A0
- ; count => A1
- ; returns:
- ; OSErr <= D0
- Macro
- _FlushCodeCacheRange
- moveq #9,D0
- dc.w $A098
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION FlushCodeCacheRange
- ENDIF
-
- ;
- ; pascal void FlushExternalCache(void )
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- Macro
- _FlushExternalCache
- moveq #6,D0
- dc.w $A098
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION FlushExternalCache
- ENDIF
-
- ENDIF ; TARGET_CPU_68K
- ;
- ; pascal void ReadLocation(MachineLocation *loc)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; parameters:
- ; loc => A0
- Macro
- _ReadLocation
- move.l #$000C00E4,D0
- dc.w $A051
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION ReadLocation
- ENDIF
-
- ;
- ; pascal void WriteLocation(const MachineLocation *loc)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; parameters:
- ; loc => A0
- Macro
- _WriteLocation
- move.l #$000C00E4,D0
- dc.w $A052
- EndM
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION WriteLocation
- ENDIF
-
-
-
- IF OLDROUTINENAMES THEN
- ENDIF ; OLDROUTINENAMES
- ;
- ; NOTE: SysEnvirons is obsolete. You should be using Gestalt.
- ;
-
- ; Environs Equates
-
- curSysEnvVers EQU 2 ;Updated to equal latest SysEnvirons version
- SysEnvRec RECORD 0
- environsVersion ds.w 1 ; offset: $0 (0)
- machineType ds.w 1 ; offset: $2 (2)
- systemVersion ds.w 1 ; offset: $4 (4)
- processor ds.w 1 ; offset: $6 (6)
- hasFPU ds.b 1 ; offset: $8 (8)
- hasColorQD ds.b 1 ; offset: $9 (9)
- keyBoardType ds.w 1 ; offset: $A (10)
- atDrvrVersNum ds.w 1 ; offset: $C (12)
- sysVRefNum ds.w 1 ; offset: $E (14)
- sizeof EQU * ; size: $10 (16)
- ENDR
-
- ; Machine Types
- envMac EQU -1
- envXL EQU -2
- envMachUnknown EQU 0
- env512KE EQU 1
- envMacPlus EQU 2
- envSE EQU 3
- envMacII EQU 4
- envMacIIx EQU 5
- envMacIIcx EQU 6
- envSE30 EQU 7
- envPortable EQU 8
- envMacIIci EQU 9
- envMacIIfx EQU 11
-
- ; CPU types
- envCPUUnknown EQU 0
- env68000 EQU 1
- env68010 EQU 2
- env68020 EQU 3
- env68030 EQU 4
- env68040 EQU 5
-
- ; Keyboard types
- envUnknownKbd EQU 0
- envMacKbd EQU 1
- envMacAndPad EQU 2
- envMacPlusKbd EQU 3
- envAExtendKbd EQU 4
- envStandADBKbd EQU 5
- envPrtblADBKbd EQU 6
- envPrtblISOKbd EQU 7
- envStdISOADBKbd EQU 8
- envExtISOADBKbd EQU 9
- ;
- ; pascal OSErr SysEnvirons(short versionRequested, SysEnvRec *theWorld)
- ;
- IF TARGET_OS_MAC ** TARGET_CPU_68K ** ¬ TARGET_RT_MAC_CFM THEN
- ; parameters:
- ; versionRequetheWorld=> D0
- ; theWorld => A0
- ; returns:
- ; OSErr <= D0
- _SysEnvirons: OPWORD $A090
- ELSEIF TARGET_OS_MAC ** TARGET_RT_MAC_CFM THEN
- IMPORT_CFM_FUNCTION SysEnvirons
- ENDIF
-
-
-
-
-
-
- ENDIF ; __OSUTILS__
-
-